# +----------------------------------------------------------------------
# | ChatWork智能聊天办公系统
# +----------------------------------------------------------------------
# | 软件声明: 本系统并非自由软件,未经授权任何形式的商业使用均属非法。
# | 版权保护: 任何企业和个人不允许对程序代码以任何形式任何目的复制/分发。
# | 授权要求: 如有商业使用需求,请务必先与版权所有者取得联系并获得正式授权。
# +----------------------------------------------------------------------
# | Author: ChatWork Team <2474369941@qq.com>
# +----------------------------------------------------------------------
from fastapi import Query
from pydantic import BaseModel, Field


class DocsRecordSearchIn(BaseModel):
    """ 对话记录搜索参数 """
    code: str = Query(..., max_length=32, description="文件编号")
    scene: str = Query(default="chat", pattern=r"^(dialogue|abstract|translate|mind)$", description="来源场景")

    class Config:
        json_schema_extra = {
            "example": {
                "scene": "dialogue",
                "code": "6a6aeecce2a53b271a89e28eaa5c2eb6"
            }
        }


class DocsRecordClearIn(BaseModel):
    """ 对话记录清空参数 """
    scene: str = Field(default="dialogue", pattern=r"^(dialogue|abstract|translate|mind)$", description="来源场景")
    code: str = Field(..., max_length=32, description="文件编号")

    class Config:
        json_schema_extra = {
            "example": {
                "scene": "dialogue",
                "code": "6a6aeecce2a53b271a89e28eaa5c2eb6"
            }
        }


class DocsRecordDeleteIn(BaseModel):
    """ 对话记录删除参数 """
    code: str = Field(..., max_length=32, description="文件编号")
    rid: str = Field(..., max_length=32, description="记录ID")

    class Config:
        json_schema_extra = {
            "example": {
                "code": "6a6aeecce2a53b271a89e28eaa5c2eb6",
                "rid": "b8aa7a4d9c1fa517ad4721df06cc634d"
            }
        }


"""--------------- Separator ---------------"""


class DocsRecordListVo(BaseModel):
    """ 对话记录列表Vo """
    class Question(BaseModel):
        id: int = Field(description="ID")
        type: str = Field(description="类型")
        avatar: str = Field(description="头像")
        content: str = Field(description="问题")
        create_time: str = Field(description="创建时间")

        class Config:
            json_schema_extra = {
                "example": {
                    "id": 1,
                    "type": "question",
                    "avatar": "https://www.wa.com/storage/image/41049f9.png",
                    "content": "1+1等于多少",
                    "create_time": "2024-11-23 23:41:31"
                }
            }

    class Answer(BaseModel):
        id: int = Field(description="ID")
        type: str = Field(description="类型")
        avatar: str = Field(description="头像")
        content: str = Field(description="答复")
        thinks: str = Field(description="思考")
        quotes: list = Field(description="引用内容")
        end_clear: bool = Field(description="清除末端")
        is_clear: bool = Field(description="是否清除")
        task_time: str = Field(description="执行耗时")
        create_time: str = Field(description="创建时间")

        class Config:
            json_schema_extra = {
                "example":  {
                    "id": 1,
                    "type": "answer",
                    "avatar": "https://www.wa.com/storage/image/robot.png",
                    "thinks": "思考过程",
                    "content": "2+2等于4。",
                    "quotes": [],
                    "end_clear": False,
                    "is_clear": False,
                    "task_time": "1.05s",
                    "create_time": "2024-11-23 23:41:31"
                }
            }
